package CutLoad.components.window
{
	/**
	 * 窗口内容区包含了一个
	 * @author smallerbird mail:smallerbird@gmail.com  site:www.mkigm.com QQ群:49983196
	 * 
	 */
	import CutLoad.Base;
	import CutLoad.components.container.ContainerV;
	
	public class CWindowContentV extends Base
	{
		private var win:CWindow;
		private var content:ContainerV;
		public function init(strTitle:String="",isCloseBtn:Boolean=true,isDrag:Boolean=true,isShowMinMaxBtn:Boolean=false,w:Number=400,h:Number=300,xspace:Number=2,yspace:Number=2):CWindowContentV{
			win=new CWindow();
			win.init(strTitle,isCloseBtn,isDrag,isShowMinMaxBtn,w,h);
			win.show(this);
			content=new ContainerV();
			content.init({w:0,h:win.getContainerShowHeight(),isAuto:true,xspace:xspace,yspace:yspace});
			win.getContainer().append(content);
			return this;
		}
		/**
		 * 获得容器 
		 * @return 
		 * 
		 */		
		public function getContainer():ContainerV{
			return content;
		}
		/**
		 * 获里边的window部件 
		 * @return 
		 * 
		 */		
		public function getPartWindow():CWindow{
			return win;
		}
		/**
		 * 添加一个元素 
		 * @param base 一个元素
		 * @param isResize 是否改变尺寸
		 * @return 
		 * 
		 */		
		public function append(base:Base,isResize:Boolean=true):void{
			content.append(base);
			if(isResize){
				content.setTakeWH();
				win.setContentWH(content.getShowWidth(),content.getShowHeight());
			}
		}
		/**
		 * 添加一些元素 
		 * @param arr Base类型的数组
		 * @return 
		 * 
		 */		
		public function appendSome(arr:Array):void{
			content.appendSome(arr);
			win.setContentWH(content.getShowWidth(),content.getShowHeight());
		}
	}
}